{% extends 'forum/base.html' %}

{% block describe %}
<!-- 主页描述 -->
<div class="content">

  <!-- Page header -->
  <div class="page-header">
              
    <div>
      {% if  plate.text == "__private__" %}
        <h4>日志详情</h4>
        <h4>
          <p>回到-<a href="{% url 'users:user_space' post.owner.id %}">个人空间</a></p>
        </h4>
      {% else %}
        <h4>文章详情</h4>
        <h4>板块：<a href="{% url 'forum:plate' plate.id %}">{{ plate }}</a></h4>
        {% if followed %}
        <a href="{% url 'forum:unfollow_post' post.id %}" class="btn btn-success pull-right" role="button">取消关注</a>
        {% else %}
        <a href="{% url 'forum:follow_post' post.id %}" class="btn btn-success pull-right" role="button">关注文章</a>
        {% endif %}
      {% endif %}
    </div>
      {% if messages %}
            {% for msg in messages %}
            <script>
                    alert('{{ msg.message }}');
            </script>
            {% endfor %}
      {% endif %}
    <div class="panel-body">
      {{ post.text|linebreaks }}
      <div class="pull-right">  --<a href="{% url 'users:user_space' post.owner.id %}">{{post.owner}}</a>,  {{ post.date_added|date:'M d, Y H:i' }}</div>
    </div>

  </div>
  <!-- /Page header -->

  <!-- Page container -->
  <div class="page-container">

    <ul class="list-inline text-right">
      <li class="pull-left"><b>所有评论：</b></li>
      <li><a href="{% url 'forum:new_comment' post.id %}" class="btn btn-primary btn-sm text-right" role="button">添加评论</a></li>
    </ul>
  
    {% for comment in comments %}
      <div class="panel panel-default">
        <div class="panel-body">
          {{ comment.text|linebreaks }}
        </div>
        <div class="panel-footer">
          <ul class="list-inline text-right">
              <li>{{ comment.date_added|date:'M d, Y H:i' }} by <a href="{% url 'users:user_space' comment.owner.id %}">{{comment.owner}}</a></li>
              <li><a href="{% url 'forum:response_comment' comment.id %}" class="btn btn-primary btn-sm text-right" role="button">
                回复</a></li>
              <li><a href="{% url 'forum:del_comment' comment.id %}" class="btn btn-primary btn-sm text-right" role="button">
                删除</a></li>
          </ul>
        </div>
      </div><!-- panel -->
      {% empty %}
        当前文章还没有评论，快去抢沙发吧！
    {% endfor %}
              
  </div>
  <!-- /Page container -->
</div>
<!-- /主页描述 -->
{% endblock describe %}



